#!/bin/bash

function auto_clone(){
    sudo mkdir gitee
    chmod -R 777 gitee
    cd gitee/
    sudo git clone https://gitee.com/sbiao123/test315/
}
auto_clone
echo "Clone Done!"

chmod -R 777 test315
cd test315/
    
unrar e u-boot-stm32mp-2020.01-r0.rar
tar -vxf u-boot-stm32mp-2020.01-r0.tar.gz
cd u-boot-stm32mp-2020.01/

for p in `ls -l ../*.patch`;do patch -p1 < $p;done

make distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- stm32mp15_basic_defconfig
make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=stm32mp157d-ev1 all -j8

echo "uboot done"